<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.Info"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.model.Tjreport"%>
<%@page import="com.model.Familycy"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>可穿戴健康监测系统</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<LINK rel="shortcut icon" type=image/x-icon href="/images/favicon.ico">
<LINK title=ITeye rel=search type=application/opensearchdescription+xml href="/open_search.xml">
<LINK title="" rel=alternate type=application/rss+xml href="/rss">
<LINK rel=stylesheet type=text/css href="frontfiles/blog.css" media=screen>
<LINK rel=stylesheet type=text/css href="frontfiles/blue.css" media=screen>
<SCRIPT type=text/javascript src="frontfiles/application.js"></SCRIPT>

<SCRIPT type=text/javascript>

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-535605-1']);
  _gaq.push(['_setDomainName', 'iteye.com']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</SCRIPT>
  </head>
  
  <BODY>
  <%CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");  %>


<jsp:include page="top.jsp"></jsp:include>


<DIV id=content class=clearfix>
<DIV>
<DIV class=blog_main_title> <SPAN>实时体征</SPAN> 
<DIV id=fd></DIV></DIV>



<%   Familycy cy = (Familycy)session.getAttribute("cy");  %>
	<table width="100%" cellpadding="1" cellspacing="1" border="0">
		<tr>
			<td valign="top">
            <script src="http://s1.bdstatic.com/r/www/cache/ecom/esl/1-6-10/esl.js"></script>
			<script type="text/javascript" src="/wearablehealthymonitorsys/admin/echarts.js"></script>  
			<script type="text/javascript" src="/wearablehealthymonitorsys/admin/jquery.js"></script>
			<div id="main1" style="height:500px;width:900px "></div>
			<button type="button" id="button1">显示/隐藏</button>
			</td>
		</tr>
		
	</table>





</DIV>


</DIV>


<jsp:include page="foot.jsp"></jsp:include>
<script type="text/javascript">

		$(function() {
			$("#button1").click(function() {
				$("#main1").slideToggle(999);
			});
		});
		var xzhou = new Array();
		var actualPower = new Array();
		var expectedPower = new Array();
		var xylist = new Array();
		var cdllist = new Array();
		var dzlist = new Array();
		var hxlist = new Array();

		function refreshOnTime(){
			$.ajax({
				url : 'test.action?cyid=<%=cy.getId()%>',
				type : 'GET',
				dataType : 'json',
				async : false,
				success : function(jsonArray) {
					for (x in jsonArray[0]) {
						xzhou[x] = jsonArray[0][x];
					}
					for (x in jsonArray[0]) {
						actualPower[x] = jsonArray[1][x];
					}
					for (x in jsonArray[0]) {
						expectedPower[x] = jsonArray[2][x];
					}
					for (x in jsonArray[0]) {
						xylist[x] = jsonArray[3][x];
					}
					for (x in jsonArray[0]) {
						cdllist[x] = jsonArray[4][x];
					}
					for (x in jsonArray[0]) {
						dzlist[x] = jsonArray[5][x];
					}
					for (x in jsonArray[0]) {
						hxlist[x] = jsonArray[6][x];
					}
				}
			});
			
		
		
		// 路径配置
		require.config({
			paths : {
				'echarts' : 'http://echarts.baidu.com/build/echarts',
				'echarts/chart/bar' : 'http://echarts.baidu.com/build/echarts'
			}
		});

		// 使用
		require([ 'echarts', 'echarts/chart/bar' // 使用柱状图就加载bar模块，按需加载
		], function(ec) {
			// 基于准备好的dom，初始化echarts图表
			var myChart = ec.init(document.getElementById('main1'));

			var option = {
				title : {
					text : '实时体征',
					subtext : ''
				},
				tooltip : {
					trigger : 'axis'
				},
				legend : {
					data : [ '体温', '脉搏', '血氧', '传导率', '电阻', '呼吸流量']
				},
				animation: false,
				toolbox : {
					show : true,
					feature : {
						mark : {
							show : true
						},
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'line']
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				xAxis : [ {
					type : 'category',
					data : xzhou
				} ],
				yAxis : [ {
					type : 'value'
				} ],
				series : [ {
					name : '体温',
					type : 'line',
					data : actualPower,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				}, {
					name : '脉搏',
					type : 'line',
					data : expectedPower,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '血氧',
					type : 'line',
					data : xylist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '传导率',
					type : 'line',
					data : cdllist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '电阻',
					type : 'line',
					data : dzlist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '呼吸流量',
					type : 'line',
					data : hxlist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				} ]
			};

			// 为echarts对象加载数据 
			myChart.setOption(option);
			//
		});
			setTimeout(refreshOnTime ,2000);
		}
		setTimeout(refreshOnTime ,2000);
	</script> 
</BODY></HTML>
